//引入express框架
const { query } = require("express")
const express=require("express")

//创建express实列
const app=express()

//get请求
app.get("/user",(req,res)=>{
    res.send({name:"李铭晗",age:22})
})

//post请求
app.post("/car",(req,res)=>{
    res.send({name:"奔驰",price:8555})
})

//获取url中的参数
app.get("/",(req,res)=>{
    console.log(req.query)
    res.send(req.query)
})

//获取url中的动态参数
app.delete("/delete/user/:id",(req,res)=>{
    console.log(req.params.id)
    res.send(req.params)
})

app.use('/clock',express.static("./clock"))
app.use('/abc',express.static("./abc"))
//开启express框架
app.listen(80,()=>{
    console.log("running at http://127.0.0.1")
})
